/*
 * @Author: your name
 * @Date: 2021-11-09 16:30:21
 * @LastEditTime: 2021-12-04 21:13:28
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\egg-example\app\controller\home.js
 */
"use strict";

const Controller = require("../core/base_controller");
class CommentController extends Controller {
    //获取评论列表
    async getCommentList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.getCommentList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //添加评论
    async addCommentList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.addCommentList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //删除评论
    async delCommentList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.delCommentList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //改变状态
    async changeCommentState() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.changeCommentState();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //通过
    async passComment() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.passComment();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //拒绝
    async refuseComment() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.refuseComment();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //批量删除
    async batchDelComments() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.batchDelComments();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //批量通过
    async batchPassComments() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.batchPassComments();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //批量拒绝
    async batchRefuseComments() {
            const { ctx } = this;
            try {
                const res = await ctx.service.comments.batchRefuseComments();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //*************用户端******************* */
        //获取每条文章评论
    async getArticleComment() {
        const { ctx } = this;
        try {
            const res = await ctx.service.comments.getArticleComment();
            this.success(res);
        } catch (err) {
            this.error(err.message);
        }
    }
}

module.exports = CommentController;